﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algorithm_2.Easy_448_FindDisappearedNumbers
{
    class MainProject
    {
        static void Main(string[] args)
        {
            //int[] intArray1 = new int[] { 4, 9, 5 };
            int[] intArray2 = new int[] {1,1 };
            foreach (var item in FindDisappearedNumbers(intArray2))
            {
                Console.WriteLine(item);
            }
            Console.ReadKey();
        }

        public static IList<int> FindDisappearedNumbers(int[] nums)
        {
            List<int> list = new List<int>();
            for (int i = 0; i < nums.Length; i++)
            {
                int index = Math.Abs(nums[i]) - 1;
                if (nums[index] > 0)
                {
                    nums[index] *= -1;
                }
            }
            for (int i = 0; i < nums.Length; i++)
            {
                if (nums[i] > 0)
                {
                    list.Add(i + 1);
                }
            }
            return list;
        }
    }
}
